package com.gitee.l0km.xthrift.mq.exception;

public class TApplicationException extends Exception{
	private static final long serialVersionUID = -3768523123998006854L;

	  public static final int UNKNOWN = 0;
	  public static final int UNKNOWN_METHOD = 1;
	  public static final int INVALID_MESSAGE_TYPE = 2;
	  public static final int WRONG_METHOD_NAME = 3;
	  public static final int BAD_SEQUENCE_ID = 4;
	  public static final int MISSING_RESULT = 5;
	  public static final int INTERNAL_ERROR = 6;
	  public static final int PROTOCOL_ERROR = 7;
	  public static final int INVALID_TRANSFORM = 8;
	  public static final int INVALID_PROTOCOL = 9;
	  public static final int UNSUPPORTED_CLIENT_TYPE = 10;

	  protected int type_ = UNKNOWN;
	  private String message_ = null;

	  public TApplicationException() {
	    super();
	  }

	  public TApplicationException(int type) {
	    super();
	    type_ = type;
	  }

	  public TApplicationException(int type, String message) {
	    super(message);
	    type_ = type;
	  }

	  public TApplicationException(String message) {
	    super(message);
	  }

	  public int getType() {
	    return type_;
	  }

	  @Override
	  public String getMessage() {
	    if (message_ == null) {
	      return super.getMessage();
	    }
	    else {
	      return message_;
	    }
	  }
}
